/**
 * 
 */
package br.org.bertol.mestrado.engine.optimisation;

import java.util.Comparator;

import br.org.bertol.mestrado.engine.optimisation.entity.Particle;

/**
 * @author contaqualquer
 * @param <U>
 */
public class OrdenateSpacialPosition implements Comparator<Particle> {

    /**
     * @see Comparator#compare(Object, Object)
     * @return -1, 0 e1
     */
    @Override
    public int compare(final Particle left, final Particle right) {

        if (left.getSpacialPosition() < right.getSpacialPosition()) {
            return -1;
        }
        if (left.getSpacialPosition() > right.getSpacialPosition()) {
            return 1;
        }

        return 0;
    }

}
